import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

// Vue.use(Router)
// 获取原型对象中的push方法
const originalPush = VueRouter.prototype.push
// 修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/goods',
    name: 'goods',
    component: () => import(/* webpackChunkName: "about" */ '../views/Goods.vue')
  },
  {
    path: '/user',
    name: 'user',
    component: () => import(/* webpackChunkName: "about" */ '../views/User.vue')
  },
  {
    path: '/ordel',
    name: 'ordel',
    component: () => import(/* webpackChunkName: "about" */ '../views/Ordel.vue')
  },
  {
    path: '/fiee',
    name: 'fiee',
    component: () => import(/* webpackChunkName: "about" */ '../views/Fiee.vue')
  },
]

const router = new VueRouter({
  routes
})

export default router
